package com.stellar.circle.controller.miniApp.sSchool;

import com.stellar.circle.controller.admin.sSchool.vo.SSchoolResponseVO;
import com.stellar.circle.domain.sSchool.SSchoolDomainService;
import com.stellar.web.core.bean.Result;
import com.stellar.web.core.validator.ValidatorRole;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 学校信息表控制器
 *
 * @author Jqchan
 * @version 1.0
 * @date 2025-05-17 18:48:37
 */
@RequestMapping("/api-miniApp/sSchool")
@RestController("miniAppSSchoolController")
@Slf4j
public class SSchoolController {

    @Resource
    private SSchoolDomainService sSchoolDomainService;

    /**
     * 获取学校列表 - 根据经纬度
     */
    @GetMapping("/getSchoolListByLocation")
    public Result<List<SSchoolResponseVO>> getSchoolListByLocation(@RequestParam(value = "longitude", required = false) Double longitude,
                                                                   @RequestParam(value = "latitude", required = false) Double latitude) {
        return Result.success(sSchoolDomainService.getSchoolListByLocation(longitude, latitude));
    }

    /**
     * 获取学校信息表详情
     */
    @GetMapping("/get/{id}")
    public Result<SSchoolResponseVO> get(@PathVariable("id") Long id) {
        return Result.success(sSchoolDomainService.get(id));
    }


}
